<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>云南省工业互联网管理平台</title>
    <link rel="stylesheet" href="/front/css/base.css"/>
    <link rel="stylesheet" href="/front/css/register/register.css"/>
    <link rel="stylesheet" href="/front/layui/css/layui.css" />
    <link rel="stylesheet" href="/front/css/iconfont.css" />
    <link rel="stylesheet" href="/front/css/bootstrap.css" />

    <script type="text/javascript" src="/front/js/jquery-3.3.1.min.js" ></script>
    <script src="/front/layui/layui.js" charset="utf-8"></script>
    <script src="/front/js/bootstrap.js"></script>
    <script src="/front/js/common.js" charset="utf-8"></script>
    <script src="/front/js/base.js" charset="utf-8"></script>
    <script src="/front/js/api.js" charset="utf-8"></script>
    <script src="/lib/serializeJSON.js" charset="utf-8"></script>
</head>
<body>
<div>
    <div class="top">
        <div><img src="/front/images/login-logo.svg"></div>
        <div class="top-text">云南省工业互联网服务平台</div>
    </div>
    <div class="middle">
        <div class="login">
            <div class="title">企业注册</div>
            <form id="loginForm" class="layui-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>用户名：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="userAccount" id="userAccount" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入用户名">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>单位名称：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="entName" id="entName" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入单位名称">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>统一社会信用代码：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="entCode" id="entCode" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入统一社会信用代码">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>法定代表人：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="legalPerson" id="legalPerson" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入法定代表人">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>单位性质：</label>
                        <div class="layui-input-inline">
                            <select name="entProperty" id="entProperty" lay-verify="required">
                                <option value="">==请选择==</option>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>注册日期：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="registerTimeStr" id="registerTimeStr" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请选择成立时间">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>注册地址：</label>
                        <div class="layui-input-inline">
                            <input type="text" name="registerAddress" id="registerAddress" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入单位地址">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>密码：</label>
                        <div class="layui-input-inline">
                            <input type="password" name="pwd" id="pwd" lay-verify="required|minLength" autocomplete="off" class="layui-input" placeholder="请输入6位以上密码">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label"><i class="red">*</i>确认密码：</label>
                        <div class="layui-input-inline">
                            <input type="password" name="rpwd" id="rpwd" lay-verify="required|minLength|confirmPass" autocomplete="off" class="layui-input" placeholder="请输入6位以上密码">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <button type="button" class="login-btn" id="save" lay-submit=""  lay-filter="save">提交注册</button>
                </div>
            </form>
        </div>
    </div>
    <div class="bottom">
        推荐使用360极速浏览器、360安全浏览器和谷歌浏览器登录系统办理业务
    </div>
</div>
<script>
    var json = [];
    json.push({ "id": "entProperty", "code": "entProperty" });//企业性质
    layuiReady (function() {
        //初始化时间控件
        laydate.render({
            elem: '#registerTimeStr',
            type: 'date'
        });
        //初始化下拉选择
        initMoreDic(json);
        _loadingClose();

        //自定义验证
        layform.verify({
            minLength:function(value){
                if(value.length < 6){
                    return '密码不能少于6位';
                }
            },
            confirmPass:function(value){
                if($('input[name=pwd]').val() !== value){
                    return '两次密码输入不一致!';
                }

            }
        });

        layform.on('submit(save)', function (data) {
            data = data.field;
            noSubmitBtn('#save');
            This.jqueryAjax(Api.register.register, data, "json", function (data) {
                if (data && data.status == 1) {
                    //弹出提示消息并关闭弹出框
                    var url = "/html/front/login/login.html";
                    Layui.confirm(data.message, {
                        btn: ['确定'],
                        cancel: function(index, layero){
                            location.href = url;
                        }
                    }, function (index) {
                        location.href = url;
                    })
                } else {
                    reSubmitBtn('#save');
                    layerMessageOk(data.message, 2);
                }
            });
        });
    })
</script>
</body>
</html>